home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Text Capture FKEY / TrapAvailable.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-10  |  534 b   |  23 lines  |  [TEXT/KAHL]

  1. #include <Traps.h>
  2.  
  3. Boolean TrapAvailable( short trapnum );
  4.  
  5. #define GetNumToolBoxTraps (NGetTrapAddress(_InitGraf,ToolTrap) == \
  6.     NGetTrapAddress(0xAA6E,ToolTrap)? 0x200 : 0x400)
  7.  
  8. #define TRAP_TYPE(n)    (n & 0x800 ? ToolTrap : OSTrap)
  9.  
  10. Boolean TrapAvailable( short trapnum )
  11. {
  12.     short    ttype;
  13.     
  14.     ttype = TRAP_TYPE( trapnum );
  15.     if (ttype == ToolTrap)
  16.     {
  17.         trapnum &= 0x7FF;
  18.         if (trapnum >= GetNumToolBoxTraps)
  19.             trapnum = _Unimplemented;
  20.     }
  21.     return (NGetTrapAddress( trapnum, ttype ) !=
  22.         NGetTrapAddress( _Unimplemented, ToolTrap ));
  23. }